<%--
  Created by IntelliJ IDEA.
  User: hp
  Date: 2019/1/15
  Time: 14:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>本月的收入</title>
    <jsp:include page="${pageContext.request.contextPath}/common/tag.jsp"/>
</head>
<body>
<!-- 为ECharts准备一个具备大小（宽高）的Dom -->
<div id="main" style="width: 100%;height:400px;"></div>
</body>
<script type="text/javascript">

    $.post('${pageContext.request.contextPath}/tongji/riqiquery',function (data) {
        console.log(data);
        var riqi = new Array();
        var money = new Array();
        $.each(data,function () {
            riqi.push(this.shopriqi);
            money.push(this.money);
        });

        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));

        option = {
            title: {
                text: '每天的收入金额'
            },
            tooltip : {
                trigger: 'axis',
                axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                    type : 'line'        // 默认为直线，可选为：'line' | 'shadow'
                }
            },
            xAxis: {
                type: 'category',
                data:  riqi
            },
            yAxis: {
                type: 'value'
            },
            series: [{
                name:'收入金额',
                type: 'line',
                barWidth: '60%',
                data: money
            }]

        };
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    })

</script>
</html>
